package org.jackysoft.util;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class FileInfo {
	private String title;
	private String realPath;
	private byte[] data;
	private String fileType;

	public FileInfo(String title, String realPath,String fileType,byte[] data) {
		this.title = title;
		this.realPath = realPath;
		this.data = data;
		this.fileType = fileType;
	}
	
	public FileInfo() {
	}
	public FileInfo(String title, String realPath) {
		this.title = title;
		this.realPath = realPath;
	}
	
	public String getName(){
		return title;
	}

	public String getTitle() {
		return StringUtils.toDownloadFileName(title);
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getRealPath() {
		return realPath;
	}

	public void setRealPath(String realPath) {
		this.realPath = realPath;
	}
	
	@Override
	public String toString(){
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}

	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

	public String getFileType() {
		return fileType;
	}

	
	public long getDataLength(){
		return data==null?0L:data.length;
	}
	
	public void setFileType(String fileType) {
		this.fileType = fileType;
	}
}
